#include "s_irq_handle.h"
#include "h_stm32_hal_defines.h"
#include <stdio.h>
#include <string.h>
#include "s_freeRTOS_event.h"
#include "h_stm32_hal_timer.h"

extern s_freeRTOS_event_t user_event_t;

void s_irq_handle_button(void)
{
	s_freeRTOS_event_enqueueFromISR(&user_event_t, s_freeRTOS_event_button_irq_evt, NULL, 0, 0);
}


void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{

	switch(GPIO_Pin) {
		case Button_IRQ_Pin:
			delay_ms(20);	
			if(GPIO_PIN_RESET == HAL_GPIO_ReadPin(Button_IRQ_GPIO_Port, Button_IRQ_Pin)) {
				s_irq_handle_button();
			}
			break;

		default:
			break;
	}
}

